package com.cosmoplat.xikai.business.domain.mes.result;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;

/**
 * @ClassName MesResult
 * @Description TODO
 * @Author wdf
 * @Date 2025/1/8
 */
@Slf4j
@Data
public class MesResult<T> {

    @ApiModelProperty(value = "状态码", required = true, example = "200")
    private int code;

    @ApiModelProperty(value = "消息", required = false)
    private String message;

    @ApiModelProperty(value = "数据", required = true)
    private T data;

    public boolean checkData() {

        if (code != 200) {
            log.error("返回数据code异常");
            return false;
        }
        if (data == null) {
            log.error("返回数据data为空");
            return false;
        }
        return true;
    }

    public boolean isSuccess() {
        if (code == 200) {
            return true;
        }
        return false;
    }
}
